<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>EventSource example</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <script src="../js/eventsource.js"></script>
    <script>
      var es = new EventSource('../eventsourceDemo');
      es.addEventListener('open', function (event) {
        var div = document.createElement('div');
        div.innerHTML = 'opened: ' + es.url;
        document.body.appendChild(div);
      });
      es.addEventListener('message', function (event) {
        document.body.appendChild(document.createTextNode(event.data));
      });
      es.addEventListener('error', function (event) {
        var div = document.createElement('div');
        div.innerHTML = 'closed';
        document.body.appendChild(div);
      });
    </script>
</head>
<body>
</body>
</html>